package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import com.itheima.pojo.Student;
import com.itheima.pojo.StudentQueryParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface StudentMapper {
    List<Student> selectStudent(StudentQueryParam studentQueryParam);

    void delStudentByIds( @Param("ids") List<Integer> ids);

    @Select("select  * from student where clazz_id = #{id} ")
    List<Student> selectStudentByClazzId(Integer id);

    void insertStudent(Student student);

    @Select("select  * from student where id = #{id}")
    Student getStudentById(Integer id);

    void updateStudent(Student student);


    @Update("update student set violation_count = violation_count+ 1 , violation_score = violation_score + #{score} where  id = #{id}")
    void updateViolation(@Param("id") Integer id, @Param("score") Integer score);
}
